#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
    pid_t pid=  fork();
    if(pid==0)
    { 
        //执行 ping www.baidu.com
        char *cmd="/usr/bin/ping";
        char *args[]={"ping","www.baidu.com","-c","5",NULL};
        char *envp[]={NULL};
        int ret= execve(cmd, args, envp);
         if(ret==-1)
         {
             perror("execve failed");
             _exit(EXIT_FAILURE);
         }
    }

    waitpid(pid,NULL,0);
    printf("  process exit\n");

    return 0;
}